package io.renren.api.controller;

import io.renren.api.entity.BtNavBarEntity;
import io.renren.api.service.BtCategroyManageService;
import io.renren.api.service.BtCustomerBaseService;
import io.renren.api.service.BtCustomerProBaseinfoService;
import io.renren.api.service.BtNavBarService;
import io.renren.api.vo.LunBoVo;
import io.renren.common.utils.PageUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Controller
public class GuoNeiPageController {
    @Autowired
    private BtNavBarService btNavBarService;
    @Autowired
    private BtCategroyManageService btCategroyManageService;
    @Autowired
    private BtCustomerBaseService btCustomerBaseService;
    @Autowired
    private BtCustomerProBaseinfoService btCustomerProBaseinfoService;
    @RequestMapping("/guonei")
    public String firstPage(Map<String,Object> backdata) {
        // modelAndView.setViewName("freemarker");
        List<BtNavBarEntity> barlist = btNavBarService.getAllNavBar();
        backdata.put("barlist",barlist);
        //首页国内主题营分类
        List<Map<String,Object>> gnztfl = btCategroyManageService.getFirstfenleicatag();
        backdata.put("navlist",gnztfl);
        //首页轮播图
        List<LunBoVo> banner = btNavBarService.getFirstLunBo(3L);
        backdata.put("banner",banner);
        //获取首页分类(夏令营机构)
        Map<String, Object> params = new HashMap<>();
        params.put("page","1");
        params.put("limit","3");
        params.put("order","asc");
        PageUtils mechanism =btCustomerBaseService.queryPage(params);
        backdata.put("mechanism",mechanism);


        //首页国内营
        List<Map<String,Object>> guoneiying= btCustomerProBaseinfoService.getGuoNeiDQFL();
        backdata.put("guoneiying",guoneiying);

        return "guonei";
    }
}
